<div class='fixed hwrap'>
		<a href='javascript:history.back(-1);' target='_parent' class='rel'>
			<i class='icon-angle-left'></i>
		</a>
		<a href='javascript:;' target='_parent'></a>
		<h3 class='dyc'>商品分类</h3>
	</div>
	<div style='height:45px;'></div>
	<!--头部-->
<!--body-->
<div class="tab_content">
    <div class="tab_nav">
        <!--左侧导航开始-->
    	<ul class="test">
	        <a href="javascript:;" onclick="request('0')">
	        	<li class="cur" list-data='0'>全部</li>
	        </a>
			<?php foreach($list as $v):?>
				<a href='javascript:;' onclick="request('<?=$v['id']?>')">
					<li list-data='<?=$v['id']?>'><?=$v['cat_title']?></li>
				</a>
			<?php endforeach;?>
		</ul>
        <!--左侧导航结束-->
    </div>
    <!--右侧列表开始-->
    <div class="tab_menu" id="tab-menu">
		<?php foreach($list as $v):?>
			<?php foreach($v['child_list'] as $va):?>
				<div class='tab_list'>
					<h2 class='tab_tit'><?=$va['cat_title']?></h2>
					<ul class='column'>
						<?php foreach($va['child_list'] as $val):?>
							<li>
								<a href='/goods/lists?cat_id=<?=$val['id']?>'>
									<img src='<?=$val['pic']?>'>
									<p><?=$val['cat_title']?></p>
								</a>
							</li>
						<?php endforeach;?>
					</ul>
				</div>
			<?php endforeach;?>
		<?php endforeach;?>
    </div>
    <!--右侧列表结束-->
</div>
<script>
function request(pid){
	$.post("/goods/cat",{pid:pid},function(rs){
	    if(rs.code == 0){
			var html = '';
			var list = rs.data.list;
			for(var i = 0;i<list.length;i++){
				var child_list0 = list[i].child_list;
				for(var j = 0;j<child_list0.length;j++){
					html += '<div class="tab_list">';
					html += '	<h2 class="tab_tit">' + child_list0[j].cat_title + '</h2>';
					html += '	<ul class="column">';
						var child_list1 = child_list0[j].child_list;
						for(var z = 0;z<child_list1.length;z++){
							html += '<li>';
							html += '	<a href="/goods/lists?cat_id=' + child_list1[z].id + '">';
							html += '		<img src="' + child_list1[z].pic + '">';
							html += '		<p>' + child_list1[z].cat_title + '</p>';
							html += '	</a>';
							html += '</li>';
						}
					html += '	</ul>';
					html += '</div>';
				}
			}
			document.getElementById('tab-menu').innerHTML = html;
			$("[list-data =" + pid + "]").addClass('cur');
			$("[list-data !=" + pid + "]").removeClass('cur');
		}else{
			layer.msg(rs.msg);
		}
	},"json");
}
</script>
